Skip to main content

Create a payment intent

POST 

/baskets/:id/payment-intents

Creates a new payment intent so that checkout can begin. During this process, the configured Payment Service Provider will be prepared to recieve the payment, and any metadata required by the front end to perform the payment againts the PSP system will be attached to the payment intent. Once complete, the basket will be locked for mutations. If the basket needs to be mutated again (such as if the customer backs out of the payment process), then the cancel payment intent endpoint must be called in order to unlock the basket and allow mutations again.

Request

Path Parameters

    id stringrequired

    The id of the basket

Header Parameters

    x-api-key stringrequired

    The API key for the given store

Body

Additional data to be passed to the payment provider

    Responses

    The PaymentIntent if an active one already exists, or a notification response that will be completed with a new Payment Intent.

    Schema
      id stringrequired

      The id of the payment intent

      status object

      Indicates what stage of it's lifecycle a payment intent is in.

      pspPaymentReference object
      pspPaylod objectrequired

      If Status is 'AwaitingPayment', this field will contain any payload that the PSP has provided to enable a payment transaction to be made. The data in this payload is irrelevant to OneBasket. The frontend will typically utilise it to enable communication with the PSP for a payment via the provider's own SDK.

    Loading...